<template>
	<view class="empty" :class="{ fixed: fixed }">
		<view class="empty_img">
			<image :src="icon"></image>
		</view>
		<view class="ns-text-color-gray ns-margin-top ns-margin-bottom empty_text">{{ text || $t('common.noData') }}</view>
		<slot name="btn"></slot>
		<!-- <button type="primary" size="mini" class="button " @click="goIndex()" v-if="isIndex && emptyBtn.text != '去登陆'">{{ emptyBtn.text }}</button>
		<button type="primary" size="mini" class="button " open-type="getUserInfo" @getuserinfo="bindgetuserinfo" @click="goIndex()" v-if="isIndex && emptyBtn.text == '去登陆'">
			{{ emptyBtn.text }}
		</button> -->
	</view>
</template>

<script>
import noData from '../../../static/images/error/no_data.png'
export default {
	name: 'ns-empty',
	data() {
		return {
			currentRoute: ''
		};
	},
	props: {
		fixed: {
			type: Boolean,
			default: true
		},
		text: {
			type: String,
			default:''
		},
		icon:{
			type: String,
			default: noData
		}
	},
	created() {
		let currentPage = getCurrentPages()[getCurrentPages().length - 1];
		this.currentRoute = '/' + currentPage.route;
	},
	methods: {
	}
};
</script>

<style lang="scss">
.empty {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 24rpx;
	box-sizing: border-box;
	.empty_img {
		width: 320rpx;
		height: 320rpx;
		image {
			width: 100%;
			height: 100%;
		}
	}
	.iconfont {
		font-size: 190rpx;
		color: #898989;
		line-height: 1.2;
	}
	.empty_text{
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #999999;
		line-height: 40rpx;
	}
	button {
		min-width: 300rpx;
		line-height: 2.9;
		margin-top: 100rpx;
	}
}
.fixed {
	position: fixed;
	left: 0;
	top: 20vh;
}
</style>
